//
//  UILabel+Extension.swift
//  weibo19
//
//  Created by Arvin on 15/11/14.
//  Copyright © 2015年 Arvin. All rights reserved.
//

import UIKit

extension UILabel {
    convenience init(title: String, size: UIFont, margin: CGFloat = 0) {
        self.init()
        text = title
        numberOfLines = 0
        font = size
        if margin != 0 {
            // 设置label自动换行
            preferredMaxLayoutWidth = screenWidth - 2 * margin
            textAlignment = .Left
        }
        sizeToFit()
    }
}
